<?php
    
    class DB {

        //valores para la conexion
        private $host="127.0.0.1";
        private $port="3306";
        private $schema="citascirujias";
        private $user="root";
        private $pass="";
        private $conexion;
        
        function __construct() {
            $server = $this->host.":".$this->port;//definir ubicacion db
            $this->conexion=  mysql_connect($server, $this->user, $this->pass) or die('No se pudo conectar: '. mysql_error());//crear conexion
            mysql_select_db($this->schema);//definir db a usar
        }
        
        function __destruct() {
            mysql_close($this->conexion);
        }

        public function pasarQuery($query) {
            return mysql_query($query,  $this->conexion) or die('Consulta fallida: '. mysql_error());
        }
        
    }

?>

